package com.miaoshaproject.validator;

import org.apache.commons.lang3.StringUtils;

import java.util.HashMap;
import java.util.Map;

public class ValidatorResult {
    private boolean hasErrors = false;
    private Map<String, String> errorMsg = new HashMap<>();


    public boolean isHasErrors() {
        return hasErrors;
    }

    public void setHasErrors(boolean hasErrors) {
        this.hasErrors = hasErrors;
    }

    public Map<String, String> getErrorMsg() {
        return errorMsg;
    }

    public void setErrorMsg(Map<String, String> errorMsg) {
        this.errorMsg = errorMsg;
    }

    //实现通用的通过格式化字符串信息获取错误结果的msg
    public String getErrMsg() {
        return StringUtils.join(errorMsg.values().toArray(), ",");
    }
}
